﻿Imports System.Globalization

Public Class RemoveAcento
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Label1.Text = "Toma a string sem acento mahhooiiii hi hiii =D.. : " & Me.RemoveAcentoCaracterEspecial(Me.TextBox1.Text)
    End Sub

    Public Function RemoveAcentoCaracterEspecial(strTexto As String) As String
        Dim strRetorno As String = String.Empty
        strTexto = strTexto.Normalize(NormalizationForm.FormD)
        Dim sb As New StringBuilder
        For Each c As Char In strTexto.ToCharArray()
            If CharUnicodeInfo.GetUnicodeCategory(c) <> UnicodeCategory.NonSpacingMark Then
                sb.Append(c)
            End If
        Next
        strRetorno = sb.ToString()

        Dim strCarac As String = "=\;,.:+*ºª[]{}-_@#$%"
        For i As Int16 = 0 To strCarac.Length - 1
            Dim Carac As String = strCarac.Substring(i, 1)
            strRetorno = strRetorno.Replace(Carac, "")
        Next
        Return strRetorno
    End Function

End Class